﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Com.Crc.ResManage.DAL.EquipManage;
using Com.Crc.PoJo.Model.Resource;

namespace Com.Crc.ResManage.BLL.EquipManage
{
    public class UMPASSPORTManagerBLL
    {
        UMPASSPORTManagerDAL dal = new UMPASSPORTManagerDAL();
        public string queryAccountInfo(String account)
        {
            System.Data.DataTable dt = dal.queryAccountInfo(account);

            UM_PASSPORT passport = new UM_PASSPORT();
            passport.S_DK = dt.Rows[0]["S_DK"].ToString();
            passport.S_NAME = dt.Rows[0]["S_NAME"].ToString();
            passport.S_TEL = dt.Rows[0]["S_TEL"].ToString();
            passport.S_ADDRESS_TYPE = dt.Rows[0]["S_ADDRESS_TYPE"].ToString();
            passport.S_ADDRESS = dt.Rows[0]["S_ADDRESS"].ToString();
            passport.N_AREA_ID = int.Parse(dt.Rows[0]["N_AREA_ID"].ToString());
            passport.S_AREA_ID_INFO = dt.Rows[0]["S_AREA_ID_INFO"].ToString();
            passport.N_IN_AREA = int.Parse(dt.Rows[0]["N_IN_AREA"].ToString());

            Jayrock.Json.JsonTextWriter writer = new Jayrock.Json.JsonTextWriter();
            Jayrock.Json.Conversion.JsonConvert.Export(passport, writer);

            string str = writer.ToString();


            return str;

        }

        public bool add(UM_PASSPORT passport )
        {
            return dal.add(passport);

        }


        public bool modify(UM_PASSPORT passport)
        {
             return dal.modify(passport);
        }

        public bool modifyAccount(UM_PASSPORT passport)
        {
            return dal.modifyAccount(passport);
        }

        public bool remove(string account)
        {
            return dal.remove(account);
        }

        public bool isexist(string account)
        {
            return dal.isexist(account);
        }
    }
}
